<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/vue.js"></script>
</head>
<body>
<div  id="root">
    <ul>

        <input v-model="keyWord">
        <button @click="update">更新</button>


        <li v-for="(p,index) in persons" :key="p.id">
            {{p.name}} -  {{p.age}}
        </li>

    </ul>
</div>

<script type="text/javascript">
<!--    用监视实现-->
    Vue.config.productionTip = false
    const  vm = new Vue({
        el:'#root',
        data:{
            keyWord:'',
            sortType:0,
            persons:[
                {id:'001',name:'马冬梅',age:'18',sex:'女'},
                {id:'002',name:'周冬雨',age:'19',sex:'女'},
                {id:'003',name:'周杰伦',age:'20',sex:'男'},
                {id:'004',name:'温兆伦',age:'21',sex:'男'},
            ],
            // filPersons:[]
        },
        methods:{
            update(){
                // this.persons[0].name = '马老师'     //奏效
                // this.persons[0].age = '50'        //奏效
                // this.persons[0].sex = '男'        //奏效
                this.persons[0] = {id:'001',name:'马老师',age:'50',sex:'男'} //不奏效

            }
        }
    })
</script>
</body>
</html>